<script setup lang="ts">
import { useDark } from '@vueuse/core'
import Menu from './Layout/menu.vue'
import { useRoute } from 'vue-router'
import { ref, watch, computed } from 'vue'

// 启用暗黑模式
useDark()

// 获取当前路由
const route = useRoute()

// 控制菜单显示的路由
const excludedPaths = ['/login', '/logout', '/404', '/error']

// 计算当前路由是否应该显示菜单
const showMenu = computed(() => {
	return !excludedPaths.some((path) => route.path === path || route.path.startsWith(`${path}/`))
})
</script>

<template>
	<router-view></router-view>

	<!-- 全局悬浮菜单，在所有页面都显示，除了登录等特殊页面 -->
	<Menu v-if="showMenu"></Menu>
</template>

<style scoped></style>
